package com.coy.web.controller;

import com.aliyuncs.exceptions.ClientException;
import com.coy.web.common.dto.DataResult;
import com.coy.web.feign.dto.SmsReq;
import com.coy.web.service.ISmsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author chenck
 * @date 2021/6/13 21:41
 */
@Slf4j
@RestController
@RequestMapping("/sms")
public class SmsController {

    @Resource
    ISmsService smsService;

    /**
     * 发送短信验证码
     */
    @PostMapping(value = "sendSmsCode")
    public DataResult sendSmsCode(@RequestBody @Valid SmsReq req) throws ClientException {
        return smsService.sendSmsCode(req);
    }
}
